import 'package:flui/flui.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class Setting extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _SettingState();
  }

}

class _SettingState extends State<Setting>{


  handleTap(){

  }

  onChanged(){

  }
  _switchValue(){

  }


  List<FLStaticSectionData> list(){
    return   [
      FLStaticSectionData(
          headerTitle: '账号',
          itemList: [
            FLStaticItemData(
                title: '性别',
                accessoryType: FLStaticListCellAccessoryType.accDetail,
                accessoryString: '未知',
                onTap: handleTap
            ),
            FLStaticItemData(
                title: '淘宝授权认证',
                accessoryType: FLStaticListCellAccessoryType.accDetail,
                accessoryString: '未授权',
                onTap: () async {
                }
            ),
            FLStaticItemData(
                title: '微信绑定',
                accessoryType: FLStaticListCellAccessoryType.accDetail,
                accessoryString: '未绑定',
                onTap: handleTap
            ),
            FLStaticItemData(
                title: '手机号',
                accessoryType: FLStaticListCellAccessoryType.accDetail,
                accessoryString: '未绑定',
                onTap: handleTap
            ),
            FLStaticItemData(
                title: '支付宝账户绑定',
                accessoryType: FLStaticListCellAccessoryType.accDetail,
                accessoryString: '未绑定',
                onTap: handleTap
            ),
          ]
      ),
      FLStaticSectionData(
          headerTitle: '设置',
          itemList: [
            FLStaticItemData(
                title: '清理缓存',
                accessoryType: FLStaticListCellAccessoryType.accDetail,
                accessoryString: '625kb',
                onTap: handleTap,
            ),
            FLStaticItemData(
              title: '关于我们',
              accessoryType: FLStaticListCellAccessoryType.accDetail,
              onTap: handleTap,
            ),
            FLStaticItemData(
              title: '用户协议',
              accessoryType: FLStaticListCellAccessoryType.accDetail,
              onTap: handleTap,
            ),
            FLStaticItemData(
              title: '隐私政策',
              accessoryType: FLStaticListCellAccessoryType.accDetail,
              onTap: handleTap,
            ),
          ]
      ),

      FLStaticSectionData(
          itemList: [
            FLStaticItemData(
                cellType: FLStaticListCellType.button,
                buttonTitle: '退出登陆',
                buttonTitleColor: Colors.red,
                onButtonPressed: () {
                  print('button pressed');
                }
            )
          ]
      )
    ];
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          elevation: 0,
          title: Text('设置'),
        ),
        body: Container(
            width: double.infinity,
            height: double.infinity,
            color: Colors.white,//Color.fromRGBO(246, 246, 246, 1),
            child: FLStaticListView(
              shrinkWrap: true,
              sections: list(),
            )
        )
    );
  }


}